package com.zhang.my.uaa.rest;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * UserResource:用户资源
 *
 * @author zhangxiaoxiang
 * @date 2021/08/15
 */
@RestController
@RequestMapping("/api")
@Slf4j
public class UserResource {
    @GetMapping("/greeting")
    public String greeting() {
        log.info("成功访问了greeting接口!");
        return "Hello World";
    }

    @PostMapping("/greeting")
    public String makeGreeting(@RequestParam String name) {
        log.info("POST接口,请求参数:{}",name);
        return "Hello "+name;
    }

    @PutMapping("/greeting/{name}")
    public String makeGreeting2(@PathVariable("name") String name) {
        log.info("PUT接口,请求参数:{}",name);
        return "Hello "+name;
    }
}
